package com.hua.springCloud.controller;

import com.hua.springCloud.entities.CommonResult;
import com.hua.springCloud.mapper.StorageMapper;
import com.hua.springCloud.service.StorageService;
import com.hua.springCloud.service.StorageServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
public class Controller {

    @Autowired
    private StorageServiceImpl storageService;

    @RequestMapping(value = "/storage/reduce")
        public CommonResult reduce(@RequestParam("productId") Long productId, @RequestParam("count") Integer count) {
        storageService.reduceCount(productId, count);
        log.info("------ storage-reduce-");
        return new CommonResult(200, "扣减库存成功！");
    }
}
